{*
 * This file is part of the Agora distribution. 
 * Detailed copyright and licensing information can be found
 * in the gpl-3.0.txt file which should be included in the distribution.
 * 
 * @version		$Id: 3.0.14 Olympus 2010-09-28 rammstein4o $
 * @copyright  2007 - 2010 jVitals
 * @license   GPLv3 Open Source
 * @link       http://jvitals.com
 * @since      File available since initial release
 *}
<script type="text/javascript">
<!--
//var agora_preview_url = '{url task=post page=poll action=preview format=raw}';
var agora_preview_url = '{url task=post page=topic action=preview format=raw}';
var empty_desc = '##Enter a brief description of your poll##';
{literal}
function agora_preview() {

	var ticon = 0;
	$$('input[name=topic_icon]').each(function(el,index){
		if(el.checked){
			ticon = el.value
		}
	});

	var preview_data = {
		req_question: $$('textarea[name=req_question]').getValue(),
		req_option: $$('textarea[name=req_option]').getValue(),
		req_message: $$('textarea[name=req_message]').getValue(),
		topic_icon: ticon,
		subject: $$('input[name=subject]').getValue(),
		desc: $$('input[name=desc]').getValue(),
		hide_smilies: $$('input[name=hide_smilies]').getValue(),
	};

	if (preview_data.desc == empty_desc) {
		preview_data.desc = '';
	}

	if (!$$('input[name=hide_smilies]').getProperty('checked')) {
		preview_data.hide_smilies = 0;
	}

	new Ajax(agora_preview_url, {
			method: 'post',
			postBody: Object.toQueryString(preview_data),
			onFailure: function(){},
			onComplete: function(inResponse) {
				var box = SqueezeBox.initialize();
				box.assignOptions();
				box.setContent('string',inResponse);
			}
	}).request();	
}
{/literal}
//-->
</script>
{if $forum.forum_name}
<div class="ag_postlinksb">
	<ul>
		<li>
			<a href="{url}">##Index##</a>
		</li>
		<li>&nbsp;&raquo;&nbsp;{$forum.forum_name}</li>
	</ul>
</div>
{/if}
<div class="ag_rightend">
	<h2 class="ag_headerbar"><span class="ag_middle">##Poll##</span></h2>
</div>
<div class="ag_outerwrap">
	<form id="post" method="post" name="post" action="{url task=poll id=$cur_forum_id page=multi action=create}" onsubmit="if (this.desc.value=='##Enter a brief description of your poll##') this.desc.value=''">
		<fieldset class="ag_inform">
			<legend class="ag_color">##New poll legend multiselect##</legend>
			<div class="ag_infldset">
				<input type="hidden" name="page" value="multi" />
				<input type="hidden" name="action" value="create" />
				<label class="ag_label">
					<strong>##Question##</strong>
					<input class="required question ag_text_area2" type="text" name="req_question" id="req_question" title="##Pleaseentertext##" size="80" maxlength="70" style="width:99%;" />
				</label>
				<br />
				{section name=opts start=1 loop=$agora_config.poll_max_fields}
				<label class="ag_label">
					<strong>##Option## {$smarty.section.opts.index}</strong>
					{if $smarty.section.opts.index > 2}
					<input class="ag_text_area2" type="text" title="##Pleaseentertext##" name="poll_option[{$smarty.section.opts.index}]" value="" size="60" maxlength="55" style="width:70%;" />
					{else}
					<input class="required option ag_text_area2" type="text" id="req_option" title="##Pleaseentertext##" name="poll_option[{$smarty.section.opts.index}]" value="" size="60" maxlength="55" style="width:70%;" />
					{/if}
				</label>
				<br />
				{/section}
			</div>
		</fieldset>
		<fieldset class="ag_inform">
			<legend class="ag_color">##Write message legend##</legend>
			{if count($topic_icons) > 1}
			<ul class="ag_topic_icons">
				{foreach from=$topic_icons item=icon}
				<li>
					<span><img src="{image src=icons/$icon.png}" alt="{$icon}" /></span>
					<input type="radio" name="topic_icon" value="{$icon}" />
				</li>
				{/foreach}
				<li>
					<span><img src="{image src=icons/info.png}" alt="0" /></span>
					<input type="radio" name="topic_icon" value="0" checked="checked" />
				</li>
			</ul>
			{/if}
			<div class="ag_clearer"></div><br />
			<label for="subject" class="ag_label">
				<strong>##Subject##:</strong>
				<input  class="required subject ag_text_area2" id="subject" title="##Pleaseentertext##" style="width:99%;" type="text" name="subject" size="80" maxlength="70" onkeydown='textCount(document.post.subject,document.post.characterstyped_2,70);' onkeyup='textCount(document.post.subject,document.post.characterstyped_2,70);' tabindex="1" />
			</label>
			<div class="ag_characterstyped">
				<input class="ag_characterstyped" readonly="readonly" type="text" name="characterstyped_2" size="4" maxlength="4" value="70" />&nbsp;##characters##
			</div>
			<br />
			<label for="desc" class="ag_label">
				<strong>##Description##:</strong>
				<input class="longinput ag_text_area2" type="text" id="desc" name="desc" size="80" style="width:99%;" maxlength="70" value="##Enter a brief description of your topic##" onblur="if(this.value=='') this.value='##Enter a brief description of your topic##';" onfocus="if(this.value=='##Enter a brief description of your topic##') this.value='';" tabindex="2" />
			</label>
			<div class="ag_clearer"></div><br />
			{include file=agora:post/post.tpl}
		</fieldset>
		<fieldset class="ag_inform">
			<legend class="ag_color">##Options##</legend>
			<div class="ag_infldset">
				<label>
					<input type="checkbox" name="hide_smilies" value="1" />##Hide smilies##
				</label>
				<br />
				<label>
					<input type="checkbox" name="subscribe" value="1" {if $agora_config.o_auto_subscriptions and $agora_user.auto_subscriptions}checked="checked"{/if} />##Subscribe##
				</label>
			</div>
		</fieldset>
		<div class="ag_postbuttons">
			<span>
				<input class="ag_button ag_btn_submit" type="submit" name="submit" value="##Submit##" title="##Submit##" accesskey="s" tabindex="5" />
				<input class="ag_button ag_btn_preview" type="button" name="preview" value="##Preview##" title="##Preview##" accesskey="p" onclick="agora_preview()" tabindex="4" />
				&nbsp;##or##&nbsp;
				<a href="javascript:void(0);" class="ag_btn_goback" title="##Go back##" onclick="javascript:history.go(-1)" tabindex="6">##Go back##</a>
			</span>
		</div>
	</form>
	<script type="text/javascript">
	<!--
	{literal}
	window.addEvent('domready', function(){
		var myFormValidation = new Validate('post',{
			errorClass: 'red',
			label: '##Please wait##'
		});
	});
	{/literal}
	//-->
	</script>
</div>